package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TPurchaseDetailMapper;
import com.ruoyi.system.domain.TPurchaseDetail;
import com.ruoyi.system.service.ITPurchaseDetailService;

/**
 * 物资采购明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-22
 */
@Service
public class TPurchaseDetailServiceImpl implements ITPurchaseDetailService 
{
    @Autowired
    private TPurchaseDetailMapper tPurchaseDetailMapper;

    /**
     * 查询物资采购明细
     * 
     * @param id 物资采购明细主键
     * @return 物资采购明细
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public TPurchaseDetail selectTPurchaseDetailById(Long id)
    {
        return tPurchaseDetailMapper.selectTPurchaseDetailById(id);
    }

    /**
     * 查询物资采购明细列表
     * 
     * @param tPurchaseDetail 物资采购明细
     * @return 物资采购明细
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public List<TPurchaseDetail> selectTPurchaseDetailList(TPurchaseDetail tPurchaseDetail)
    {
        return tPurchaseDetailMapper.selectTPurchaseDetailList(tPurchaseDetail);
    }

    /**
     * 新增物资采购明细
     * 
     * @param tPurchaseDetail 物资采购明细
     * @return 结果
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public int insertTPurchaseDetail(TPurchaseDetail tPurchaseDetail)
    {
        tPurchaseDetail.setCreateTime(DateUtils.getNowDate());
        return tPurchaseDetailMapper.insertTPurchaseDetail(tPurchaseDetail);
    }

    /**
     * 修改物资采购明细
     * 
     * @param tPurchaseDetail 物资采购明细
     * @return 结果
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public int updateTPurchaseDetail(TPurchaseDetail tPurchaseDetail)
    {
        return tPurchaseDetailMapper.updateTPurchaseDetail(tPurchaseDetail);
    }

    /**
     * 批量删除物资采购明细
     * 
     * @param ids 需要删除的物资采购明细主键
     * @return 结果
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public int deleteTPurchaseDetailByIds(Long[] ids)
    {
        return tPurchaseDetailMapper.deleteTPurchaseDetailByIds(ids);
    }

    /**
     * 删除物资采购明细信息
     * 
     * @param id 物资采购明细主键
     * @return 结果
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public int deleteTPurchaseDetailById(Long id)
    {
        return tPurchaseDetailMapper.deleteTPurchaseDetailById(id);
    }
}
